Hi all, |
Re: Issue in finding the backslash \ with an regular expression command
Backslashed in regexp are tricky since the regular expression syntax wants you to escape the backslashes:
Regexp re = regexp "c:\\\\(.*)"
string s = "c:\\DXL"
if (re s ) {
print "Match found. Path on drive C: " s[match 1] "\n"
} else print "No match :-("
|
Re: Issue in finding the backslash \ with an regular expression command Mathias Mamsch - Thu Apr 01 06:29:45 EDT 2010
Backslashed in regexp are tricky since the regular expression syntax wants you to escape the backslashes:
Regexp re = regexp "c:\\\\(.*)"
string s = "c:\\DXL"
if (re s ) {
print "Match found. Path on drive C: " s[match 1] "\n"
} else print "No match :-("
Thanks a lot for answering this question. It seems really trick with four backslashes in the regexp. Best Regards. |
Re: Issue in finding the backslash \ with an regular expression command |